<extend name="./Application/Common/View/block/base.php" />
<block name="header">
    <include file="./Application/Admin/View/block/easyui_header.php" />
    <style>
        #dg{
            height: 100%;;
        }
    </style>
</block>
<block name="bdoy">
    <body>
    <div id="log_window" class="easyui-window" data-options="closed:true" style="width:1090px;height:530px;">
        <iframe id="window_iframe" style="width:1070px;height:486px;"></iframe>
    </div>
    <table id="grid_waterele"></table>
    <div id="grid_waterele_ToolBar" style="padding:5px;height:auto">
        <div id="queryParamZone_waterele">
            <form id="queryForm_Waterele" method="post" action="">
                <table>
                    <tr>
                        <td>调蓄池</td>
                        <td><input id="ps_id_combox" name="ps_id"></td>
                        <td>水表：</td>
                        <td><select id="p_id" name="f_id" valueField="id" textField="we_name" style="width: 100px;"></select></td>
                        <td>填报状态</td>
                        <td>
                            <select name="is_quick_report" data-options="prompt:'{:LANG('pls_input')}',required:true" style="width: 100px;">
                                {:is_quick_report()}
                            </select>
                        </td>
                        <td>水表名称</td>
                        <td>
                            <input type="text" name="we_name" style="width: 100px;">
                        </td>
                        <td>水表表号</td>
                        <td>
                            <input type="text" name="we_number" style="width: 100px;">
                        </td>
                        <td><a id="btnQueryWaterele" href="#" class="easyui-linkbutton" iconCls="icon-search">查询</a></td>
                        <td><a href="#" class="easyui-linkbutton" iconCls="icon-undo" onclick="javascript:$('#queryForm_Waterele').form('clear');">重置</a></td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td>
                            <div id="search_tag_content" style="width: 1000px;"></div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    </body>
</block>
<block name="footExtendJs">
    <script type="text/javascript">
        //$.noConflict();

        $(window).resize(function() {
            $('#grid_waterele').datagrid('resize');
        });

        function clearwatereleForm(){
            $('#watereleForm').form('clear');
        }

        function clearQueryParamZone(){
            $('#queryForm_Waterele').form('clear');
        }

        $(function(){
            $('#ps_id_combox').combobox({
                url:'/Manage/AdminCsdt/get_all_combox',
                valueField:'id',
                textField:'name',
                width:180,
                multiple:true,
                prompt:'支持多选',
                onSelect: function (record){
                    var text = record.name;
                    if(record.name=='全部'){
                        text = '全部调蓄池';
                    }
                    create_search_tag(text, 'ps_id', record.id);
                    $('#p_id').combobox('clear');
                    $('#p_id').combobox('reload','/Manage/AdminCsdtWater/get_all_water?ps_id='+get_search_tag_ids('ps_id'));
                    $(this).combobox('clear');
                    $('#grid_waterele').datagrid('resize');
                }
            });
            $('#p_id').combobox({
                url:'/Manage/AdminCsdtWater/get_all_water?ps_id=',
                valueField:'id',
                textField:'we_number',
                width:100,
                multiple:true,
                prompt:'支持多选',
                onSelect: function (record){
                    var text = record.we_number;
                    if(record.we_number=='全部'){
                        text = '全部水表';
                    }
                    create_search_tag(text, 'f_id', record.id);
                    $(this).combobox('clear');
                    $('#grid_waterele').datagrid('resize');
                }
            });
            $('#p_id').combobox({
                url:'/Manage/AdminCsdtWater/get_all_water?ps_id=',
                valueField:'id',
                textField:'we_number',
                width:100,
                prompt:'支持多选',
                onSelect: function (record){
                    if(record.id == ''){
                        $(this).combobox('clear');
                        $(this).combobox('setValue', '');
                    }else{
                        $(this).combobox('unselect', '');
                    }
                }
            });
            $('#grid_waterele').datagrid({
                //title:'水水表',
                width: '100%',
                //height: 400,
                fit: true,
                nowrap: false,
                striped: true,
                collapsible:false,
                url:'/Manage/AdminCsdtWater/get_all',
                queryParams:{gen:1,page:1,rows:20},
                method:'get',
                pageNumber:1,
                pageSize:20,
                idField:'id',
                remoteSort: false,
                showFooter: true,
                columns:[[
                    {field:'sta_name',title:'调蓄池名称',width:180,align:'center'},
                    {field:'we_name',title:'水表名称',width:100,align:'center'},
                    {field:'we_number',title:'水表表号',width:100,align:'center'},
                    {field:'status_text',title:'是否及时填报',width:80,align:'center'},
                    {field:'date',title:'填报日期',width:140,align:'center'},
                    {field:'waterdegrees',title:'水表读数',width:140,align:'center'},
                    {field:'work_person',title:'当前执勤人员',width:250,align:'center'},
                    {field:'work_log',title:'运行记录',width:80,align:'center'},
                ]],
                pagination:true,
                rownumbers:true,
                singleSelect:false,
                toolbar: '#grid_waterele_ToolBar',
                rowStyler: function(index,row){
                    if (row.status == 0){
                        return 'background:#EEEE00;';
                    }
                },
                onLoadSuccess: function(data) {
                    $(this).datagrid('resize');
                }
            });

            $('#btnQueryWaterele').click(function() {
                query_fy_form();
            });

            var model = 'PumpPump';
            table_index_change(model, 'base');
        });

        function query_fy_form(){
            $('#grid_waterele').datagrid('resize');
            var obj = $('#queryForm_Waterele').serializeJson();
            obj['ps_id'] = get_search_tag_ids('ps_id');
            obj['f_id'] = get_search_tag_ids('f_id');
            obj['gen'] = '1';
            $('#grid_waterele').datagrid('load',obj);
        }

    </script>
</block>
